//
//  ZCBestViewController.m
//  03地图定位
//
//  Created by 张聪 on 16/7/22.
//  Copyright © 2016年 张聪. All rights reserved.
//

#import "ZCBestViewController.h"
#import "ViewController.h"
#import "Masonry.h"
#import "ZCBaiduViewController.h"

@interface ZCBestViewController ()

@end

@implementation ZCBestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor greenColor];
    
    [self settingUI];
    
}

#pragma mark - setui
- (void)settingUI {
    UIButton *navBtn = [[UIButton alloc] init];
    
    navBtn.backgroundColor = [UIColor orangeColor];
    navBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [navBtn setTitle:@"自定义定位导航" forState:UIControlStateNormal];
    
    [navBtn addTarget:self action:@selector(didNavBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:navBtn];
    
    UIButton *baiduBtn = [[UIButton alloc] init];
    baiduBtn.backgroundColor = [UIColor orangeColor];
    baiduBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [baiduBtn setTitle:@"百度地图导航" forState:UIControlStateNormal];
    
    [baiduBtn addTarget:self action:@selector(didBaiduBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:baiduBtn];
    
    
    [navBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.view).offset(-80);
        make.centerX.equalTo(self.view);
        make.width.mas_equalTo(130);
        make.height.mas_equalTo(30);
        
    }];
    
    [baiduBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(navBtn.mas_bottom).offset(60);
        make.centerX.equalTo(self.view);
        make.width.mas_equalTo(120);
        make.height.mas_equalTo(30);
        
    }];
    
    
}

#pragma mark - 百度地图导航
- (void)didBaiduBtnClick {
    
    [self.navigationController pushViewController:[[ZCBaiduViewController alloc] init] animated:YES];
}

#pragma mark - 自定义地图导航
- (void)didNavBtnClick {
    
    ViewController *viewController = [[ViewController alloc] init];
    
    //    __weak typeof(self)weakSelf = self;
    
    [self.navigationController pushViewController:viewController animated:YES];
    
}

- (void)dealloc {
    
    NSLog(@"ZCBestViewController销毁了");
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
